package com.homework.collections;

import com.ZmqTools.Zmq_Random.Zmq_Random;

import java.util.ArrayList;
import java.util.Collections;

public class Dog {
  private String color;
  private int weight;

  public Dog(String color, int weight) {
    this.color = color;
    this.weight = weight;
  }

  public String getColor() {
    return color;
  }

  public void setColor(String color) {
    this.color = color;
  }

  public int getWeight() {
    return weight;
  }

  public void setWeight(int weight) {
    this.weight = weight;
  }

  public static void main(String[] args) {
    //  ArrayList<Dog> dogs = new ArrayList<>();
    String[] colors = new String[] {"黄", "白", "黑", "黑白", "黄黑"};
    ArrayList<Dog> dogs = new ArrayList<>();
    for (int i = 0; i < 20; i++) {
      int weight = Zmq_Random.getAnum(1, 50);
      String color = colors[Zmq_Random.getAnum(1, 5)];
      dogs.add(new Dog(color, weight));
    }

    //    System.out.println(dogs);
    Collections.reverse(dogs);

    int all_weight = 0;
    for (Dog dog : dogs) {
      all_weight += dog.weight;
    }
    System.out.println("Average:" + (all_weight / 20));

    for (int i = 0; i < dogs.size(); i++) {
      if(dogs.get(i).weight == 20 && dogs.get(i).color.equals("白") ){
        System.out.println();
      }
    }
//    Collections.max()
  }
}
